#include "hplczkyssendcommonsystempacket.h"
#include "hplczkysprotocolcommondata.h"
#include "hplczkyspfcid.h"
#include "hplczkysmakepacket.h"
#include "hplczkyscheckpacket.h"
#include <QDebug>
#include "debug.h"

namespace hplc
{
namespace zkys
{

HplcZkysSendCommonSystemPacket::HplcZkysSendCommonSystemPacket(HplcZkysProtocolCommonData &data)
{
    m_d = &data;
}

void HplcZkysSendCommonSystemPacket::setReset()
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_RESET);
    m_d->m_checker->sendNoRetry();
}

void HplcZkysSendCommonSystemPacket::setRestoreDefault(quint8 flag)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_RESTORE_DEFAULT, flag);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::setSaveAsDefault()
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_SAVE_AS_DEFAULT);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::setSuperPassword(char *str)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_SUPERPASSWORD, str);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::getSuperPassword()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_SUPERPASSWORD);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::getSoftwareVersion()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_SOFTWARE_VERSION);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::getHardwareVersion()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_HARDWARE_VERSION);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::setProductDate(char *str)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_PRODUCT_DATE, str);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::getProductDate()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_PRODUCT_DATE);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::setSerialNumber(char *str)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_SERIAL_NUMBER, str);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::getSerialNumber()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_SERIAL_NUMBER);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::setModel(quint8 model)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_MODEL, model);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::getModel()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_MODEL);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::setModelString(char *str)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_MODEL_STRING, str);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::getModelString()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_MODEL_STRING);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::setUsedTime(quint32 time)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_USED_TIME, time);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::getUsedTime()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_USED_TIME);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::setProtocol(quint8 protocol)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_PROTOCOL, protocol);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::getProtocol()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_PROTOCOL);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::setDebugPort(quint8 port)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_DEBUG_PORT, port);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::getDebugPort()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_DEBUG_PORT);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::setPrintVariants()
{
    m_d->m_maker->makePacket(SET_PFC(PFC_GLOBAL_EXT_SYSTEM), (quint8)PFC_GES_DEBUG_VARIANTS);
    m_d->m_checker->sendRetry();
}

void HplcZkysSendCommonSystemPacket::setRandomCode(quint32 randomCode)
{

}

void HplcZkysSendCommonSystemPacket::getRandomCode()
{

}

void HplcZkysSendCommonSystemPacket::setActiveCode(quint32 activeCode)
{

}

void HplcZkysSendCommonSystemPacket::getActiveCode()
{

}

void HplcZkysSendCommonSystemPacket::setUsefulDays(quint16 usefulDays)
{

}

void HplcZkysSendCommonSystemPacket::getUsefulDays()
{

}

void HplcZkysSendCommonSystemPacket::setPowerOnInfo(quint8 code, char *info)
{

}

} // zkys
} // hplc

